using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Viettel.VOFFICE.DAO.Models.Mapping
{
    public class v_UserControllerActionMappingMap : EntityTypeConfiguration<v_UserControllerActionMapping>
    {
        public v_UserControllerActionMappingMap()
        {
            // Primary Key
            this.HasKey(t => t.UserItem);

            // Properties
            this.Property(t => t.ControllerName)
                .HasMaxLength(100);

            this.Property(t => t.ActionName)
                .HasMaxLength(100);

            this.Property(t => t.ControllerDisplayName)
                .HasMaxLength(255);

            this.Property(t => t.ActionDisplayName)
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("v_UserControllerActionMapping");
            this.Property(t => t.UserItem).HasColumnName("UserItem");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.ControllerName).HasColumnName("ControllerName");
            this.Property(t => t.ActionName).HasColumnName("ActionName");
            this.Property(t => t.ControllerDisplayName).HasColumnName("ControllerDisplayName");
            this.Property(t => t.ActionDisplayName).HasColumnName("ActionDisplayName");
            this.Property(t => t.IsActive).HasColumnName("IsActive");
            this.Property(t => t.IsAccept).HasColumnName("IsAccept");
            this.Property(t => t.IsDenied).HasColumnName("IsDenied");

            // Relationships
            this.HasRequired(t => t.aspnet_Users)
                .WithMany(t => t.v_UserControllerActionMapping)
                .HasForeignKey(d => d.UserId);

        }
    }
}
